//
//  HEReminderDBParse.m
//  Chat
//
//  Created by 任伟 on 16/3/8.
//  Copyright © 2016年 任伟. All rights reserved.
//

#import "HEReminderDBParse.h"
#import "RWDBVersionManager.h"
#import "DbUtil.h"
#define TableName   ReminderTableName


@implementation HEReminderDBParse

/// 添加提醒
+ (BOOL)addReminderWithModel:(RWReminderDetailModel *)model {

    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"];
    NSDateFormatter *formatter1= [[NSDateFormatter alloc] init];
    [formatter1 setDateFormat:@"YYYYY-MM-dd HH:mm"];
    
    if ([model.reminderType integerValue] != 4) {
        model.date = [NSString stringWithFormat:@"%@",[formatter1 stringFromDate:[formatter dateFromString:model.date]]];
    }
    model.firstDate = [NSString stringWithFormat:@"%@", model.date];
    model.isNotication = NO;
    
    if ([[DbUtil sharedDatabase] execUpdate:[NSString stringWithFormat:@"CREATE TABLE IF NOT EXISTS %@ (date text,ringName text,repeat text,repeatCustom text,ahead text,reminderType text,explain text,firstDate text,id text,countDownSec text,runStatus text);",TableName]]) {
        
//        model.id = [NSString stringWithFormat:@"%ld",  (long)[[NSDate date] timeIntervalSince1970]];
//        return [[DbUtil sharedDatabase] executeInsert:TableName valuemap:[self modelToDictionaryWithModel:model]];
    }
    
    return NO;
}

/// 模型转字典
@end
